package daily;

import java.util.HashMap;
import java.util.Scanner;

public class Meituan03_1 {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] robots = new int[N][2];

        HashMap<Integer, Integer> map = new HashMap<>();
        int left = 0, right = 0;
        sc.nextLine();
        for(int i = 0; i < N; i++){
            String[] line = sc.nextLine().split(" ");
            robots[i][0] = Integer.parseInt(line[0]);
            if(line[1].equals("L")){
                robots[i][1] = -1;
                left++;
            }
            else if(line[1].equals("R")){
                robots[i][1] = 1;
                right++;
            }
            map.put(robots[i][0],i);
        }
        int count = N, time = 0;
        while (count > 1 && !isEnd(robots)){
            time++;
            for(int i = 0; i < N; i++){
                if(robots[i][1] == 0) continue;
                int newLocation = robots[i][0] + robots[i][1];
                if(map.get(newLocation) == null){
                    map.put(newLocation, i);
                    robots[i][0] = newLocation;
                }else{
                    int temp = map.get(newLocation);
                    robots[temp][0] = time;
                    if(robots[temp][1] == 1)
                        right--;
                    else left--;
                    robots[temp][1] = 0;
                    if(robots[i][1] == 1)
                        right--;
                    else left--;
                    robots[i][1] = 0;
                    robots[i][0] = time;
                    map.remove(newLocation);
                    count -= 2;
                }
            }
            map.clear();
        }
        for(int i = 0; i < N; i++){
            if(robots[i][1] == 0)
                System.out.println(robots[i][0]);
            else
                System.out.println("-1");
        }

    }
    public static boolean isEnd(int[][] robots){
        int maxL = Integer.MIN_VALUE, minR = Integer.MAX_VALUE;
        for(int i = 0; i < robots.length; i++){
            if(robots[i][1] == -1)
                maxL = Math.max(maxL, robots[i][0]);
            else if(robots[i][1] == 1)
                minR = Math.min(minR, robots[i][0]);
        }
        return maxL < minR;
    }
}
